<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/css/index.css"/>
	</head>

	<body>
		<span id="refresh" onclick="location.href = location.href"></span>
		<a href="{:U('Carousel/add')}">添加</a>
		<table>
			<thead>
				<tr>
					<th>ID</th>
					<th>IMG</th>
					<th>URL</th>
					<th>ORDERNUM</th>
					<th>操作</th>
					<th>操作</th>
				</tr>
			</thead>

			<tbody>
				<volist name="data" id="row">
					<tr>
						<td>{$row["id"]}</td>
						<td><img src="__UPLOADS__/{$row['img']}" width="40" height="40"/></td>
						<td>{$row["url"]}</td>
						<td><input style="text-align: center;" type="text" value="{$row['ordernum']}" autocomplete="off" onblur="order(this, {$row['id']})" /></td>
						<td>
							<a href="{:U('edit',array('id'=>$row['id']))}">修改</a>
						</td>
						<td>
							<a href="{:U('delete',array('id'=>$row['id']))}">删除</a>
						</td>
					</tr>
				</volist>
			</tbody>

		</table>
		
		
		<!-- 引入jQuery3js -->
		<script src="__PUBLIC__/js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
		
		
		<script type="text/javascript">
			// ajax刷新轮播图顺序
			function order(obj, id) {
				$.post("{:U('Carousel/ajax_order')}", {
			        id: id,
			        ordernum: $(obj).val(),
			   	}, function(data, status) {
			        if(data) {
			        	$("#refresh").click();
			        }else {
			        	alert(0);
			        }
			    });
			}
		</script>
	</body>

</html>